[ci] Reorganizing artifact upload#730
Conversation
…min12/s3-organization
| def create_index_file(args): | ||
| logging.info("Creating index file") | ||
| index_file_path = THEROCK_DIR / "third-party" / "indexer" / "indexer.py" | ||
| build_dir = args.build_dir | ||
|
|
||
| subprocess.run( | ||
| [sys.executable, index_file_path, "-f", "*.tar.xz*", build_dir / "artifacts"] | ||
| ) |
There was a problem hiding this comment.
This overlaps with some work that @erman-gurses has been doing over at #648, moving the log file uploading and maybe log index page generation into the teatime.py script invoked by the build system.
A few things to consider about the architecture:
- We should have flexible scripts that can be reused from multiple different contexts, like CI jobs and on developer machines. The log indexer and artifact fetcher are both good examples right of that right now. As we add more composite scripts like this one, we should be careful to preserve that property.
- Do we want "artifact upload" to be scoped to github actions, or can it be more generic? I think here we could move this script up a level and keep the github-specific steps behind environment variables, as is already done in teatime.py:
TheRock/build_tools/teatime.py
Lines 29 to 32 in e6ecc6b
| python build_tools/github_actions/artifact_upload.py \ | ||
| --repo ${{ github.repository }} \ | ||
| --run-id ${{ github.run_id }} \ | ||
| --amdgpu-family ${{ env.AMDGPU_FAMILIES }} \ | ||
| --build-dir build/ |
There was a problem hiding this comment.
This has come up in the review of @erman-gurses 's #648 a bit, but I do like how this collapses the .yml down to a single python script invocation instead of inlining the individual subcommands and bash conditions.
Where it interfaces with that PR is that the build logs will be uploaded to S3 during the build, either at the end of the build or continuously (streaming). The build log index can either also be generated by the same process or it can be generated here at the end in the action. Longer term I think we should consider having a dynamic index page or some server-side processing so we don't need to think as carefully during the build about generating a static index page and uploading it along with the otherwise loose log files.
There was a problem hiding this comment.
At some point, I need integrate the log part into teatime.py script. I need to change the architecture of #648 anyway. If @ScottTodd thinks this will make teatime.py script integration easier, I am ok to land this.
There was a problem hiding this comment.
I saw that too, I think i'll split this up into more scripts, that way it'll be easier to pinpoint where to add the teatime script
There was a problem hiding this comment.
I would like that. The separation will be easier for me.
|
The PR does not only handle the artifacts here but also the logs. I think |
erman-gurses
left a comment
There was a problem hiding this comment.
LGTM! Couple of minor things.
| with: | ||
| repository: "ROCm/TheRock" | ||
| # for testing purposes | ||
| ref: users/geomin12/s3-organization |
There was a problem hiding this comment.
you can remove this after the testing is done.
There was a problem hiding this comment.
Run working in rocm-libraries
Were these ref: changes even needed on this PR itself? I'm a bit confused about the sequencing here. Prefer to keep test changes out of PRs so we can accurately review the changes as they will be merged.
There was a problem hiding this comment.
no it is not! i just added it for testing purposes to have it in rocm-libraries. i'll remove it now and have this run through
| parser.add_argument( | ||
| "--amdgpu-family", type=str, required=True, help="AMD GPU family to upload" | ||
| ) |
There was a problem hiding this comment.
I'd really like to remove this amdgpu-family plumbing, to keep as much of our infrastructure as generic as possible.
Once we move the index generation server side there will only be one usage in this file:
s3_base_path = f"{bucket_uri}/logs/{amdgpu_family}"For that we can treat it as a generic "logs subdirectory". In fact, we could even make that change right now, just across all the other places that also look at the string (e.g. the index page url).
|
Run working in rocm-libraries |
ScottTodd
left a comment
There was a problem hiding this comment.
Bit of clean up then this looks good to me
| with: | ||
| repository: "ROCm/TheRock" | ||
| # for testing purposes | ||
| ref: users/geomin12/s3-organization |
There was a problem hiding this comment.
Run working in rocm-libraries
Were these ref: changes even needed on this PR itself? I'm a bit confused about the sequencing here. Prefer to keep test changes out of PRs so we can accurately review the changes as they will be merged.
| shell: powershell | ||
| run: | | ||
| $Env:PATH += ";C:\Program Files\Amazon\AWSCLIV2" | ||
| python3 build_tools/upload_logs_to_s3.py ` | ||
| --build-dir=${{ env.BASE_BUILD_DIR_POWERSHELL }} ` |
There was a problem hiding this comment.
Looks like BASE_BUILD_DIR_POWERSHELL is no longer used thanks to these scripts replacing shell: powershell usage. We can remove that variable in a follow-up.
Changes:
ROCm/TheRock, artifacts are uploaded to the external s3 bucketthird-partyindexer.pyfile now